package com.yinxin.thread;

import com.yinxin.util.ThreadUtil;

/**
 * @author yinxin
 * @Title:
 * @Package
 * @Description:
 * @date 2022/1/710:13
 */
public class Test2Thread implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            ThreadUtil.sleep(1000);
            System.out.println("我在看代码");
        }
    }

    public static void main(String[] args) {
        //创建runnable的接口的实现类对象
        Test2Thread test2Thread = new Test2Thread();
        Thread thread = new Thread(test2Thread);
        thread.start();
        for (int i = 0; i < 100; i++) {
            ThreadUtil.sleep(1000);
            System.out.println("我是主线程");
        }
    }
}
